﻿/*----------------------------------------------------------------
//  <copyright file="UserLoginBase.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2023-12-06 18:36</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Identity.Entities
{
    #region "用户第三方登录信息基类"
    /// <summary>
    /// 用户第三方登录信息基类
    /// </summary>
    /// <typeparam name="TKey">主键类型</typeparam>
    /// <typeparam name="TUserKey">用户编号类型</typeparam>
    [EventEntityIgnore]
    public abstract class UserLoginBase<TKey, TUserKey> : EntityBase<TKey>, ICreatedTime
        where TKey : struct, IEquatable<TKey>
        where TUserKey : struct, IEquatable<TUserKey>
    {
        #region "属性"
        #region "获取或设置 用户编号"
        /// <summary>
        /// 获取或设置 用户编号
        /// </summary>
        [Column("UserId")]
        [Required]
        [DisplayName("用户编号")]
        public TUserKey UserId { get; set; }
        #endregion

        #region "获取或设置 登录提供程序"
        private string _LoginProvider = "";
        /// <summary>
        /// 获取或设置 登录提供程序
        /// <para>例如：微信, QQ, 钉钉等。</para>
        /// </summary>
        [Column("LoginProvider")]
        [Required, DefaultValue("")]
        [StringSize(StringSizeType.Name)]
        [DisplayName("登录提供程序")]
        public string LoginProvider { get { return _LoginProvider; } set { _LoginProvider = value.ReplaceNull(); } }
        #endregion
        #region "获取或设置 登录唯一标识"
        private string _ProviderKey = "";
        /// <summary>
        /// 获取或设置 登录唯一标识
        /// </summary>
        [Column("ProviderKey")]
        [Required, DefaultValue("")]
        [StringSize(StringSizeType.General)]
        [DisplayName("登录唯一标识")]
        public string ProviderKey { get { return _ProviderKey; } set { _ProviderKey = value.ReplaceNull(); } }
        #endregion
        #region "获取或设置 显示名称"
        private string _DisplayName = "";
        /// <summary>
        /// 获取或设置 显示名称
        /// </summary>
        [Column("DisplayName")]
        [StringSize(StringSizeType.Name)]
        [DisplayName("显示名称")]
        public string DisplayName { get { return _DisplayName; } set { _DisplayName = value.ReplaceNull(); } }
        #endregion
        #region "获取或设置 头像"
        private string _Avatar = "";
        /// <summary>
        /// 获取或设置 头像
        /// </summary>
        [Column("Avatar")]
        [StringMax]
        [DisplayName("头像")]
        public string Avatar { get { return _Avatar; } set { _Avatar = value.ReplaceNull(); } }
        #endregion

        #region "获取或设置 创建时间 ICreatedTime、ICreationAudited  可装载接口，在数据创建时可自动设置当前时间"
        /// <summary>
        /// 获取或设置 创建时间
        /// </summary>
        [Column("CreatedTime")]
        [DisplayName("创建时间")]
        public DateTime CreatedTime { get; set; }
        #endregion

        #endregion

    }
    #endregion

}
